
package edu.tongji.jiaowu.dao.jdbc;
 
import java.util.List;

import edu.tongji.jiaowu.dao.ClassroomDao;
import com.tongji.quickCRUDQ.define.Row;
import com.tongji.quickCRUDQ.model.CommonBean;
import com.tongji.quickCRUDQ.dao.jdbc.BaseDaoJdbc;

public class ClassroomDaoJdbc extends BaseDaoJdbc implements ClassroomDao {
	String tableName="T_CLASSROOM";
	String beanName="classroom";
	
	public CommonBean createClassroom(){
		CommonBean classrooms=this.createBean(tableName,beanName);
                return classrooms;		
	}
	
/*
	public CommonBean findClassrooms(String refid) {
		CommonBean classrooms=this.createClassroom();
		String sql="select * from T_CLASSROOM where refid=?";
		List data=this.getCommonDao().select(sql,new String[]{refid});
		classrooms.addData(data);
                return classrooms;
       }
*/
	public CommonBean findClassroomById(String id) {
		CommonBean classrooms=this.createClassroom();
		String sql="select * from T_CLASSROOM where id=?";
		List data=this.getCommonDao().select(sql,new String[]{id});
		classrooms.addData(data);
    return classrooms;
  }
  
	public CommonBean findAllClassrooms() {
		CommonBean classrooms=this.createClassroom();
		String sql="select * from T_CLASSROOM ";
		List data=this.getCommonDao().select(sql,new String[]{});
		classrooms.addData(data);
    return classrooms;
  }
	public void insertClassroom(CommonBean classroomBean){
		List data=classroomBean.getData();
		Row row=this.getRow(tableName);
		this.getCommonDao().templateBatchInsert(row,data,this.getIdGenerator());
	}
}

